package richbar.com.richbar.util;

import android.util.Log;
import com.okhttp.network.HttpUtils;
import java.io.File;
import java.util.HashMap;
import java.util.Map;
import richbar.com.richbar.base.BaseApplication;



/**
 * Created by Administrator on 2018/10/13
 * 网络辅助类
 */
public class NetWorkUtil {
    public static final String URL = "http://ht.fuba325.com";//IP地址
    public static final String APK_URL = "http://ht.fuba325.com";//IP地址
    private static final String LOGIN = "/api/user/login?";//登录
    private static final String REGISTER = "/api/user/register?";//注册
    private static final String GETGEGSINCODE = "/api/sms/send?";//获取注册验证码
    private static final String FORGETPWD = "/api/user/forget_pwd?";//忘记密码
    private static final String INFO = "/api/user/info?";//获取用户相关信息
    private static final String EDITINFO = "/api/user/edit";//编辑用户相关信息
    private static final String UPDATEPAYPWD = "/api/user/update_paypwd?";//修改支付密码接口
    private static final String UPDATEPWD = "/api/user/update_pwd?";//修改密码接口
    private static final String FORGETPAYPWD = "/api/user/forget_paypwd?";//忘记支付密码接口
    private static final String NOPAYLIST = "/api/user/NoPwdPayList?";//获取免密支付金额选项接口
    private static final String OPENNOPWDPAY = "/api/user/openNoPwdPay?";//开启免密支付接口
    private static final String ADDRESSLIST = "/api/user/address_list?";//获取地址列表接口
    private static final String ADDRESS = "/api/user/address_add?";//添加地址接口
    private static final String EDITRESS = "/api/user/address_edit?";//编辑地址接口
    private static final String DELADDRESS = "/api/user/address_del?";//删除地址接口
    private static final String DEFADDRESS = "/api/user/address_def?";//设置默认地址接口
    private static final String APPLY = "/api/auth/apply?";//申请实名认证接口
    private static final String STATUS = "/api/auth/status?";//查询实名认证状态接口
    private static final String NAME_INFO = "/api/auth/info?";//实名认证信息
    private static final String SELLERAPPLY = "/api/seller/apply?";//申请入驻接口
    private static final String SELLERSTATUS = "/api/seller/status?";//查询入驻申请状态接口
    private static final String GETSHOPINFO = "/api/seller/info?";//获取店铺介绍接口
    private static final String ADDCOLLECT = "/api/collect/add?";//添加收藏接口
    private static final String DELCOLLECT = "/api/collect/del?";//删除收藏接口
    private static final String GOODSLIST = "/api/collect/goodslist?";//获取收藏的商品列表接口
    private static final String SELLERLIST = "/api/collect/sellerlist?";//获取收藏的店铺列表接口000000000
    private static final String GETLIST = "/api/goods/getlist?";//获取商品列表接口
    private static final String GOODSINFO = "/api/goods/info?";//获取商品详情列表接口
    private static final String GETPRICE = "/api/goods/getPrice?";//获取商品价格接口
    private static final String GETCARTLIST = "/api/cart/getlist?";//获取购物车列表接口
    private static final String ADDCART = "/api/cart/add?";//添加购物车接口
    private static final String UPDATECART = "/api/cart/update?";//更新购物车接口
    private static final String DETCART = "/api/cart/del?";//删除购物车接口
    private static final String SUBMITORDER = "/api/order/submit?";//提交订单接口
    private static final String GETORDERLIST = "/api/order/getList?";//获取订单列表
    private static final String CASHAPPLY = "/api/cash/apply?";//申请提现接口
    private static final String VERSION = "/api/version?";//获取最新的版本信息，和当前的app版本号对比，如果不一致则提示更新接口
    private static final String HOME = "/api/home?";//获取首页数据接口
    private static final String CATE = "/api/cate/getlist?";//获取商品分类列表接口
    private static final String CATE_LEFT = "/api/cate/cate1";//获取商品分类列表接口
    private static final String CATE_RIGHT = "/api/cate/cate2";//获取商品分类列表接口
    private static final String SHOPCARTSELECT = "/api/cart/select";//购物车选中接口
    private static final String GETRATELIST = "/api/rate/getlist?";//评价列表
    private static final String SHOPHOME = "/api/seller/home?";//店铺首页
    private static final String SELECTPAYKIND = "/api/order/paymethod?";//选择付款方式
    private static final String PRICE = "/api/order/price?";
    private static final String PERSON = "/api/assets/person?";//获取个人收入数据
    private static final String REBATE = "/api/assets/rebate?";//获取待返金额数据
    private static final String CASHBACK = "/api/assets/cashBack?";//获取可用金额数据
    private static final String INTEGRAL = "/api/assets/integral?";//获取积分账户数据
    private static final String RECHARGE = "/api/assets/page_recharge_balance?";//获取余额充值页面
    private static final String SETADDRESS = "/api/goods/setaddr";//选中地址
    private static final String MYRATE = "/api/myrate/getlist";//我的评价
    private static final String DELRATE = "/api/myrate/del";
    private static final String SUBRATE = "/api/rate/submit";
    private static final String CANCELORDER = "/api/order/cancel_purchase";//取消订单
    private static final String REMINDERORDER = "/api/order/reminder";//订单提醒发货
    private static final String STARTRECHARGE = "/api/recharge/topay";//发起余额充值
    private static final String BINDWX = "/api/bundling/index";
    private static final String BINDWXSTATUS = "/api/bundling/status";
    private static final String UPDATEPAYPWDS = "/api/user/update_paypwd";//设置支付密码接口
    private static final String SETPAYPWD = "/api/user/set_paypwd";//设置支付密码接口
    private static final String NoPwdPayList = "/api/user/NoPwdPayList";//获取免密支付接口
    private static final String OpenNoPwdPay = "/api/user/openNoPwdPay";//开启免密支付接口
    private static final String SETPAY = "/api/order/pay";//设置订单已付款
    private static final String ISBAND = "/api/bundling/isbund";//判断用户微信绑定
    private static final String BANDWX = "/api/bundling/wx";//用户微信绑定
    private static final String RECEIVING = "/api/order/receiving";//确认收货
    private static final String BundLingTeL = "/api/bundling/tel";//判断手机号是否绑定

    /**
     * 登录
     */
    public static void login(String access_token, String type, String id, String pwd, String code, HttpUtils.HttpCallback callback) {
        Map<String, String> map = new HashMap<>();
        map.put("username", id);
        map.put("type", type);
        map.put("password", pwd);
        map.put("code", code);
        map.put("access_token", access_token);
        new HttpUtils().post(URL + LOGIN, map, callback);
    }

    /**
     * 注册
     *f000000.
     * @param access_token
     * @param uname
     * @param code
     * @param pwdg
     * @param callback
     */
    public static void register(String access_token, String uname, String code, String pwd, HttpUtils.HttpCallback callback) {
        Map<String, String> map = new HashMap<>();
        map.put("uname", uname);
        map.put("code", code);
        map.put("password", pwd);
        map.put("access_token", access_token);
        map.put("dev", "1");
        new HttpUtils().post(URL + REGISTER, map, callback);
    }

    /**
     * 获取注册验证码
     *
     * @param access_token
     * @param mobile
     * @param callback
     */
    public static void getRegsinCode(String access_token, String mobile, String scene, HttpUtils.HttpCallback callback) {
        Map<String, String> map = new HashMap<>();
        map.put("mobile", mobile);
        map.put("uid", "0");
        map.put("scene", scene);//场景：1=注册 2=登录 3=忘记密码 4=认证 5=修改密码 6=修改支付密码 7=忘记支付密码
        map.put("access_token", access_token);
        new HttpUtils().post(URL + GETGEGSINCODE, map, callback);
    }

    /**
     * 忘记密码
     *
     * @param access_token
     * @param username
     * @param code
     * @param pwd
     * @param callback
     */
    public static void forgetPwd(String access_token, String username, String code, String pwd, HttpUtils.HttpCallback callback) {
        Map<String, String> map = new HashMap<>();
        map.put("username", username);
        map.put("code", code);
        map.put("password", pwd);
        map.put("access_token", access_token);
        new HttpUtils().post(URL + FORGETPWD, map, callback);
    }

    /**
     *
     */
    public static void bindWx(String mobile, String code, String openid, String nickname, String head, HttpUtils.HttpCallback callback) {
        Map<String, String> map = new HashMap<>();
        map.put("mobile", mobile);
        map.put("code", code);
        map.put("openid", openid);
        map.put("nickname", nickname);
        map.put("head", head);
        map.put("access_token", Util.md5());
        new HttpUtils().post(URL + BINDWX, map, callback);
    }


    /**
     *
     */
    public static void bindWxStatus(String openid, String nickname, String head, HttpUtils.HttpCallback callback) {
        Map<String, String> map = new HashMap<>();
        map.put("openid", openid);
        map.put("nickname", nickname);
        map.put("head", head);
        map.put("access_token", Util.md5());
        new HttpUtils().post(URL + BINDWXSTATUS, map, callback);
    }

    /**
     * 获取用户信息
     *
     * @param uid
     * @param access_token
     * @param callback
     */
    public static void getInfo(String uid, String access_token, HttpUtils.HttpCallback callback) {
        Map<String, String> map = new HashMap<>();
        map.put("uid", uid);
        map.put("access_token", access_token);
        new HttpUtils().post(URL + INFO, map, callback);
    }

    public static void editInfoHead(String head, HttpUtils.HttpCallback callback) {
        Map<String, String> map = new HashMap<>();
        map.put("uid", BaseApplication.uid);
        map.put("access_token", Util.md5());
        map.put("value", head);
        map.put("field", "head");
        new HttpUtils().post(URL + EDITINFO,  map, callback);
    }

    public static void editInfoNickname(String nickname, HttpUtils.HttpCallback callback) {
        Map<String, String> map = new HashMap<>();
        map.put("uid", BaseApplication.uid);
        map.put("access_token", Util.md5());
        map.put("value", nickname);
        map.put("field", "nickname");
        new HttpUtils().post(URL + EDITINFO, map, callback);
    }

    public static void editInfoSex(String sex, HttpUtils.HttpCallback callback) {
        Map<String, String> map = new HashMap<>();
        Map<String, File> map_file = new HashMap<>();
        map.put("uid", BaseApplication.uid);
        map.put("access_token", Util.md5());
        map.put("value", sex);
        map.put("field", "sex");
        new HttpUtils().post(URL + EDITINFO, map, callback);
    }

    public static void editInfoBirth(String birth, HttpUtils.HttpCallback callback) {
        Map<String, String> map = new HashMap<>();
        Map<String, File> map_file = new HashMap<>();
        map.put("uid", BaseApplication.uid);
        map.put("access_token", Util.md5());
        map.put("value", birth);
        map.put("field", "birth");
        new HttpUtils().post(URL + EDITINFO, map, callback);
    }

    /**
     * 修改密码
     *
     * @param mobile       手机号
     * @param code         短信验证码
     * @param oldpassword  旧支付密码
     * @param newpassword  新支付密码
     * @param access_token 直接这么调取 Util.md5()
     * @param callback
     */
    public static void updatePwd(String mobile, String code, String oldpassword, String newpassword, String access_token, HttpUtils.HttpCallback callback) {
        Map<String, String> map = new HashMap<>();
        map.put("uid", BaseApplication.uid);
        map.put("mobile", mobile);
        map.put("code", code);
        map.put("oldpassword", oldpassword);
        map.put("newpassword", newpassword);
        map.put("access_token", access_token);
        new HttpUtils().post(URL + UPDATEPWD, map, callback);
    }

    /**
     * 修改支付密码
     *
     * @param mobile       手机号
     * @param code         短信验证码
     * @param oldpassword  旧支付密码
     * @param newpassword  新支付密码
     * @param access_token 直接这么调取 Util.md5()
     * @param callback
     */
    public static void updatePayPwd(String mobile, String code, String newpassword, String oldpassword, String access_token, HttpUtils.HttpCallback callback) {
        Map<String, String> map = new HashMap<>();
        map.put("mobile", mobile);
        map.put("code", code);
        map.put("oldpassword", oldpassword);
        map.put("newpassword", newpassword);
        map.put("access_token", access_token);
        new HttpUtils().post(URL + UPDATEPAYPWD, map, callback);
    }

    /**
     * 忘记支付密码
     *
     * @param mobile      手机号
     * @param code        短信验证码
     * @param newpassword 密码
     * @param
     * @param callback
     */
    public static void forgetPayPwd(String mobile, String code, String newpassword, HttpUtils.HttpCallback callback) {
        Map<String, String> map = new HashMap<>();
        map.put("mobile", mobile);
        map.put("code", code);
        map.put("newpassword", newpassword);
        map.put("access_token", Util.md5());
        new HttpUtils().post(URL + FORGETPAYPWD, map, callback);
    }

    /**
     * 获取免密支付金额选项
     *
     * @param callback
     */
    public static void noPayList(HttpUtils.HttpCallback callback) {
        Map<String, String> map = new HashMap<>();
        new HttpUtils().post(URL + NOPAYLIST, map, callback);
    }

    /**
     * 开启免密支付
     *
     * @param uid          用户ID BaseApplication.uid
     * @param amountID     金额选项ID
     * @param access_token
     * @param callback
     */
    public static void openNoPwdPay(String uid, String amountID, String access_token, HttpUtils.HttpCallback callback) {
        Map<String, String> map = new HashMap<>();
        map.put("uid", uid);
        map.put("amountID", amountID);
        map.put("access_token", access_token);
        new HttpUtils().post(URL + OPENNOPWDPAY, map, callback);
    }

    /**
     * 获取地址列表
     *
     * @param uid
     * @param access_token
     * @param callback
     */
    public static void addRessList(String uid, String access_token, HttpUtils.HttpCallback callback) {
        Map<String, String> map = new HashMap<>();
        map.put("uid", uid);
        map.put("access_token", access_token);
        new HttpUtils().post(URL + ADDRESSLIST, map, callback);
    }

    /**
     * 添加地址
     *
     * @param uid          用户ID
     * @param name         姓名
     * @param mobile       手机号
     * @param address      详细地址
     * @param province     省ID
     * @param city         市ID
     * @param area         区ID
     * @param access_token
     * @param callback
     */
    public static void addRess(String uid, String name, String mobile, String address, String province, String city, String area, String street, String access_token, HttpUtils.HttpCallback callback) {
        Map<String, String> map = new HashMap<>();
        map.put("uid", uid);
        map.put("name", name);
        map.put("mobile", mobile);
        map.put("address", address);
        map.put("province", province);
        map.put("city", city);
        map.put("area", area);
        map.put("street", street);
        map.put("access_token", access_token);
        new HttpUtils().post(URL + ADDRESS, map, callback);
    }

    /**
     * 编辑地址
     *
     * @param uid          用户ID
     * @param name         姓名
     * @param mobile       手机号
     * @param address      详细地址
     * @param province     省ID
     * @param city         市ID
     * @param area         区ID
     * @param access_token
     * @param callback
     */
    public static void editRess(String id, String uid, String name, String mobile, String address, String province, String city, String area, String street, String access_token, HttpUtils.HttpCallback callback) {
        Map<String, String> map = new HashMap<>();
        map.put("uid", uid);
        map.put("id", id);
        map.put("name", name);
        map.put("mobile", mobile);
        map.put("address", address);
        map.put("province", province);
        map.put("city", city);
        map.put("area", area);
        map.put("street", street);
        map.put("access_token", access_token);
        new HttpUtils().post(URL + EDITRESS, map, callback);
    }

    /**
     * 删除地址
     *
     * @param id           地址ID，多个地址传入逗号分隔的字符串，例如：1,2,3,4
     * @param access_token
     * @param callback
     */
    public static void delAddRess(String id, String access_token, HttpUtils.HttpCallback callback) {
        Map<String, String> map = new HashMap<>();
        map.put("id", id);
        map.put("access_token", access_token);
        new HttpUtils().post(URL + DELADDRESS, map, callback);
    }

    public static void setDefaultAddress(String id, HttpUtils.HttpCallback callback) {
        Map<String, String> map = new HashMap<>();
        map.put("id", id);
        map.put("access_token", Util.md5());
        map.put("uid", BaseApplication.uid);
        new HttpUtils().post(URL + DEFADDRESS, map, callback);
    }

    /**
     * 申请实名认证接口
     *
     * @param uid          用户ID
     * @param name         姓名
     * @param mobile       手机号
     * @param code         短信验证码
     * @param idnumber     身份证号
     * @param access_token
     * @param callback
     */
    public static void apply(String uid, String name, String mobile, String code, String idnumber, String access_token, HttpUtils.HttpCallback callback) {
        Map<String, String> map = new HashMap<>();
        map.put("uid", uid);
        map.put("name", name);
        map.put("mobile", mobile);
        map.put("code", code);
        map.put("idnumber", idnumber);
        map.put("access_token", access_token);
        new HttpUtils().post(URL + APPLY, map, callback);
    }

    /**
     * 查询实名认证状态
     *
     * @param uid
     * @param access_token
     * @param callback
     */
    public static void status(String uid, String access_token, HttpUtils.HttpCallback callback) {
        Map<String, String> map = new HashMap<>();
        map.put("uid", uid);
        map.put("access_token", access_token);
        new HttpUtils().post(URL + STATUS, map, callback);
    }


    public static void getRealNameInfo(String uid, String access_token, HttpUtils.HttpCallback callback) {
        Map<String, String> map = new HashMap<>();
        map.put("uid", uid);
        map.put("access_token", access_token);
        new HttpUtils().post(URL + NAME_INFO, map, callback);
    }

    /**
     * 申请入驻
     *
     * @param uid          用户ID
     * @param cname        企业名称
     * @param mobile       手机号码
     * @param fname        法人
     * @param fcard        法人身份证，上传文件
     * @param license      营业执照，上传文件
     * @param banknum      收款银行账号
     * @param bank         收款银行
     * @param bankpermit   银行开户许可，上传文件
     * @param brand        商标证书，上传文件
     * @param access_token
     * @param callback
     */
    public static void sellerApply(String uid, String cname, String mobile, String fname, File fcard, File license,
                                   String banknum, String bank, File bankpermit, File brand, String access_token, HttpUtils.HttpCallback callback) {
        Map<String, String> map = new HashMap<>();
        Map<String, File> map_file = new HashMap<>();
        map.put("uid", uid);
        map.put("cname", cname);
        map.put("mobile", mobile);
        map.put("fname", fname);
        map_file.put("fcard", fcard);
        map_file.put("license", license);
        map.put("banknum", banknum);
        map.put("bank", bank);
        map_file.put("bankpermit", bankpermit);
        map_file.put("brand", brand);
        map.put("access_token", access_token);
        new HttpUtils().postFile(URL + SELLERAPPLY, map_file, map, callback);
    }

    /**
     * 查询入驻申请状态
     *
     * @param uid
     * @param access_token
     * @param callback
     */
    public static void sellerStatus(String uid, String access_token, HttpUtils.HttpCallback callback) {
        Map<String, String> map = new HashMap<>();
        map.put("uid", uid);
        map.put("access_token", access_token);
        new HttpUtils().post(URL + SELLERSTATUS, map, callback);
    }

    /**
     * 获取店铺介绍
     *
     * @param uid
     * @param sid
     * @param access_token
     * @param callback
     */
    public static void getShopInfo(String uid, String sid, String access_token, HttpUtils.HttpCallback callback) {
        Map<String, String> map = new HashMap<>();
        map.put("uid", uid);
        map.put("sid", sid);
        map.put("access_token", access_token);
        new HttpUtils().post(URL + GETSHOPINFO, map, callback);
    }

    /**
     * 添加收藏
     *
     * @param uid          用户ID
     * @param type         类型：1=商品2=店铺
     * @param obj          商品或店铺的ID
     * @param access_token
     * @param callback
     */
    public static void addCollect(String uid, String type, String obj, String access_token, HttpUtils.HttpCallback callback) {
        Map<String, String> map = new HashMap<>();
        map.put("uid", uid);
        map.put("type", type);
        map.put("obj", obj);
        map.put("access_token", access_token);
        new HttpUtils().post(URL + ADDCOLLECT, map, callback);
    }

    /**
     * 删除收藏
     *
     * @param coll_id  收藏ID，多个传入逗号分隔字符串，例如：1,2,3,4
     * @param callback
     */
    public static void delCollect(String type, String coll_id, HttpUtils.HttpCallback callback) {
        Map<String, String> map = new HashMap<>();
        map.put("type", type);
        map.put("coll_id", coll_id);
        map.put("access_token", Util.md5());
        map.put("uid", BaseApplication.uid);
        new HttpUtils().post(URL + DELCOLLECT, map, callback);
    }

    /**
     * 获取收藏的商品列表
     *
     * @param page         页码
     * @param num          每页数量，默认6条
     * @param uid          会员ID
     * @param access_token
     * @param callback
     */
    public static void goodList(String page, String num, String uid, String access_token, HttpUtils.HttpCallback callback) {
        Map<String, String> map = new HashMap<>();
        map.put("page", page);
        map.put("num", num);
        map.put("uid", uid);
        map.put("access_token", access_token);
        new HttpUtils().post(URL + GOODSLIST, map, callback);
    }

    /**
     * 获取收藏的店铺列表
     *
     * @param page         页码
     * @param num          每页数量，默认6条
     * @param uid          会员ID
     * @param access_token
     * @param callback
     */
    public static void sellerList(String page, String num, String uid, String access_token, HttpUtils.HttpCallback callback) {
        Map<String, String> map = new HashMap<>();
        map.put("page", page);
        map.put("num", num);
        map.put("uid", uid);
        map.put("access_token", access_token);
        new HttpUtils().post(URL + SELLERLIST, map, callback);
    }

    /**
     * 获取商品列表
     *
     * @param page         页码
     * @param num          每页数量，默认6条
     * @param keyword      关键字
     * @param sort         排序，1=综合，2=销量倒序，3=价格正序，4=价格倒序
     * @param sortmin      筛选的开始价格
     * @param sortmax      筛选的结束价格
     * @param access_token
     * @param callback
     */
    public static void getList(String page, String num, String keyword, String sort, String sortmin, String sortmax, String access_token, HttpUtils.HttpCallback callback) {
        Map<String, String> map = new HashMap<>();
        map.put("page", page);
        map.put("num", num);
        map.put("keyword", keyword);
        map.put("sort", sort);
        map.put("sortmin", sortmin);
        map.put("sortmax", sortmax);
        map.put("access_token", access_token);
        new HttpUtils().post(URL + GETLIST, map, callback);
    }

    /**
     * 获取商品详情
     *
     * @param id           商品id
     * @param access_token
     * @param callback
     */
    public static void goodsInfo(String id, String access_token, HttpUtils.HttpCallback callback) {
        Map<String, String> map = new HashMap<>();
        map.put("id", id);
        map.put("uid", BaseApplication.uid);
        map.put("access_token", access_token);
        Log.d("商品详情",id+"/"+BaseApplication.uid);
        new HttpUtils().post(URL + GOODSINFO, map, callback);
    }


    public static void getGoodsPrice(String id, HttpUtils.HttpCallback callback) {
        Map<String, String> map = new HashMap<>();
        map.put("id", id);
        map.put("access_token", Util.md5());
        new HttpUtils().post(URL + GETPRICE, map, callback);
    }

    /**
     * 获取购物车列表
     *
     * @param uid          用户ID BaseApplication.uid
     * @param access_token
     * @param callback
     */
    public static void getCarList(String uid, String access_token, HttpUtils.HttpCallback callback) {
        Map<String, String> map = new HashMap<>();
        map.put("uid", uid);
        map.put("access_token", access_token);
        Log.d("--==uid===",uid);
        new HttpUtils().post(URL + GETCARTLIST, map, callback);
    }

    /**
     * 添加购物车
     *
     * @param uid          用户ID
     * @param goods_id     商品id
     * @param num          商品数量
     * @param access_token
     * @param callback
     */
    public static void addCart(String uid, String goods_id, String num, String price, String attr, String access_token, HttpUtils.HttpCallback callback) {
        Map<String, String> map = new HashMap<>();
        map.put("uid", uid);
        map.put("goods_id", goods_id);
        map.put("num", num);
        map.put("price", price);
        map.put("attr", attr);
        map.put("access_token", access_token);
        new HttpUtils().post(URL + ADDCART, map, callback);
    }

    /**
     * 更新购物车
     *
     * @param uid          用户ID
     * @param cart_id      购物车id
     * @param num          商品数量
     * @param access_token
     * @param callback
     */

    public static void UpdateCart(String uid, String cart_id, String num, String access_token, HttpUtils.HttpCallback callback) {
        Map<String, String> map = new HashMap<>();
        map.put("uid", uid);
        map.put("cart_id", cart_id);
        map.put("num", num);
        map.put("access_token", access_token);
        new HttpUtils().post(URL + UPDATECART, map, callback);
    }

    /**
     * 删除购物车
     *
     * @param uid          用户id
     * @param id           购物车id或店铺id、全部删除不传或传0，传入逗号分割字符串，例如：1,2,3,4
     * @param type         删除类型：1=按购物车id删除，2=按店铺id删除，3=全部删除
     * @param access_token
     * @param callback
     */
    public static void delCart(String uid, String id, String type, String access_token, HttpUtils.HttpCallback callback) {
        Map<String, String> map = new HashMap<>();
        map.put("uid", uid);
        map.put("id", id);
        map.put("type", type);
        map.put("access_token", access_token);
        Log.d("Del", uid + "/" + id + "/" + type + "/" + access_token);
        new HttpUtils().post(URL + DETCART, map, callback);
    }

    /**
     * @param addrid       地址id
     * @param amount       订单金额
     * @param remark       订单备注
     * @param shipping     配送方式：1=线下自提 2=平台发货
     * @param balance      使用余额数
     * @param pay_method   支付方式
     * @param score        使用蚂蚁豆数
     * @param coupon       使用蚂蚁券数
     * @param invoice      是否开发票：1=不开 2=开发票
     * @param invoice_name 发票名头
     * @param invoice_type 发票类型：1=个人2=企业
     * @param goods        商品列表数组，数组格式：['id'=>1,'num'=>1,'price'=>10,'attr'=>'1,2']
     *                     id:商品id
     *                     num:商品数量
     *                     price:商品价格
     *                     attr:商品规格id字符串，逗号分隔
     * @param callback
     */
    public static void subitOrder(String addrid, String amount, String remark,
                                  String shipping, String balance, String pay_method,
                                  String score, String coupon, String invoice, String invoice_name,
                                  String invoice_type, String goods, HttpUtils.HttpCallback callback) {
        Map<String, String> map = new HashMap<>();
        map.put("uid", BaseApplication.uid);
        map.put("addrid", addrid);
        map.put("amount", amount);
        map.put("remark", remark);
        map.put("shipping", shipping);
        map.put("pay_method", pay_method);
        map.put("balance", balance);
        map.put("score", score);
        map.put("coupon", coupon);
        map.put("invoice", invoice);
        map.put("type", "1");
        map.put("goods", goods);
        map.put("invoice_name", invoice_name);
        map.put("invoice_type", invoice_type);
        map.put("access_token", Util.md5());
        new HttpUtils().post(URL + SUBMITORDER, map, callback);
    }

    public static void getOrderList(String page, String num, String isShipping, String isPay, HttpUtils.HttpCallback callback) {
        Map<String, String> map = new HashMap<>();
        map.put("uid", BaseApplication.uid);
        map.put("page", page);
        map.put("num", num);
        map.put("isShipping", isShipping);
        map.put("isPay", isPay);
        map.put("access_token", Util.md5());
        Log.d("OD", "uid:" + BaseApplication.uid + "page:" + page + "num:" + num + "isSHipping:" + isShipping + "isPay:" + isPay + "access_token:" + Util.md5());
        new HttpUtils().post(URL + GETORDERLIST, map, callback);
    }

    /**
     * 申请提现接口
     *
     * @param role         1=会员2=商家
     * @param id           会员id或商家id
     * @param type         提现类型
     * @param amount       提现金额
     * @param mode         提现方式
     * @param bank         收款银行
     * @param banknum      收款账号
     * @param remark       提现备注
     * @param access_token
     * @param callback
     */
    public static void cashApply(String role, String id, String type, String amount, String mode,
                                 String bank, String banknum, String remark, String access_token, HttpUtils.HttpCallback callback) {
        Map<String, String> map = new HashMap<>();
        map.put("role", role);
        map.put("id", id);
        map.put("type", type);
        map.put("amount", amount);
        map.put("mode", mode);
        map.put("bank", bank);
        map.put("banknum", banknum);
        map.put("remark", remark);
        map.put("access_token", access_token);
        new HttpUtils().post(URL + CASHAPPLY, map, callback);
    }

    /**
     * 获取最新的版本信息
     *
     * @param dev          设备类型：1=安卓2=ios
     * @param access_token
     * @param callback
     */
    public static void getVersion(String dev, String access_token, HttpUtils.HttpCallback callback) {
        Map<String, String> map = new HashMap<>();
        map.put("dev", dev);
        map.put("access_token", access_token);
        new HttpUtils().post(URL + VERSION, map, callback);
    }

    /**
     * 获取首页数据
     *
     * @param callback
     */
    public static void getHomeData(String access_token, HttpUtils.HttpCallback callback) {
        Map<String, String> map = new HashMap<>();
        map.put("access_token", access_token);
        new HttpUtils().post(URL + HOME, map, callback);
    }

    /**
     * 获取分类数据
     *
     * @param callback
     */
    public static void getCateData(String access_token, HttpUtils.HttpCallback callback) {
        Map<String, String> map = new HashMap<>();
        map.put("access_token", access_token);
        new HttpUtils().post(URL + CATE, map, callback);
    }

    /**
     * 获取分类数据
     *
     * @param callback
     */
    public static void getCateLeft(String access_token, HttpUtils.HttpCallback callback) {
        Map<String, String> map = new HashMap<>();
        map.put("access_token", access_token);
        new HttpUtils().post(URL + CATE_LEFT, map, callback);
    }

    /**
     * 获取分类数据
     *
     * @param callback
     */
    public static void getCateRight(String access_token, String id, HttpUtils.HttpCallback callback) {
        Map<String, String> map = new HashMap<>();
        map.put("access_token", access_token);
        map.put("id", id);
        new HttpUtils().post(URL + CATE_RIGHT, map, callback);
    }

    /**
     * 购物车是否选中状态
     *
     * @param access_token
     * @param uid
     * @param type         1=按店铺选2=按购物车id选3=全部
     * @param dos          string类型，操作：select选中、cancelselect取消选中
     * @param id           店铺id或者购物车id（购物车id支持传入多个id，逗号分割）
     * @param callback
     */
    public static void setSpSelect(String access_token, String uid, String type, String dos, String id, HttpUtils.HttpCallback callback) {
        Map<String, String> map = new HashMap<>();
        map.put("access_token", access_token);
        map.put("uid", uid);
        map.put("type", type);
        map.put("do", dos);
        map.put("id", id);
        Log.d("==XX", access_token + "/" + uid + "/" + type + "/" + dos + "/" + id);
        new HttpUtils().post(URL + SHOPCARTSELECT, map, callback);
    }

    public static void getRateList(String page, String num, String gid, HttpUtils.HttpCallback callback) {
        Map<String, String> map = new HashMap<>();
        //map.put("uid", BaseApplication.uid);
        map.put("page", page);
        map.put("num", num);
        map.put("gid", gid);
        map.put("access_token", Util.md5());
        new HttpUtils().post(URL + GETRATELIST, map, callback);
    }

    public static void getShopHome(String id, HttpUtils.HttpCallback callback) {
        Map<String, String> map = new HashMap<>();
        //map.put("uid", BaseApplication.uid);
        map.put("id", id);
        map.put("access_token", Util.md5());
        map.put("uid", BaseApplication.uid);
        new HttpUtils().post(URL + SHOPHOME, map, callback);
    }

    /**
     * 选择付款方式
     *
     * @param method   付款方式：
     *                 1=全部现金
     *                 2=全部金币
     *                 3=待返金额支付（待返金额）
     *                 4=可用金额支付（已返金额）
     *                 5=蚂蚁豆支付
     *                 6=蚂蚁券支付
     * @param callback
     */
    public static void getSelectPayKind(String method, HttpUtils.HttpCallback callback) {
        Map<String, String> map = new HashMap<>();
        map.put("method", method);
        map.put("access_token", Util.md5());
        map.put("uid", BaseApplication.uid);
        new HttpUtils().post(URL + SELECTPAYKIND, map, callback);
    }


    public static void getPrice(String bean, String coupon, String type, String id, String attr, HttpUtils.HttpCallback callback) {
        Map<String, String> map = new HashMap<>();
        map.put("bean", bean);
        map.put("coupon", coupon);
        map.put("type", type);
        map.put("id", id);
        map.put("attr", attr);
        map.put("access_token", Util.md5());
        map.put("uid", BaseApplication.uid);
        new HttpUtils().post(URL + PRICE, map, callback);
    }


    public static void subitOrders(String uid, String addrid, String amount, String remark,
                                   String shipping, String balance, String pay_method,
                                   String score, String coupon, String invoice, String invoice_name,
                                   String invoice_type, String type, String goods, HttpUtils.HttpCallback callback) {
        Map<String, String> map = new HashMap<>();
        map.put("uid", uid);
        map.put("addrid", addrid);
        map.put("amount", amount);
        map.put("remark", remark);
        map.put("shipping", shipping);
        map.put("pay_method", pay_method);
        map.put("balance", balance);
        map.put("score", score);
        map.put("coupon", coupon);
        map.put("invoice", invoice);
        map.put("goods", goods);
        map.put("invoice_name", invoice_name);
        map.put("invoice_type", invoice_type);
        map.put("type", type);
        map.put("access_token", Util.md5());
        new HttpUtils().post(URL + SUBMITORDER, map, callback);
    }

    /**
     * 获取个人收入接口
     *
     * @param callback
     */
    public static void getPerson(HttpUtils.HttpCallback callback) {
        Map<String, String> map = new HashMap<>();
        map.put("access_token", Util.md5());
        map.put("uid", BaseApplication.uid);
        new HttpUtils().post(URL + PERSON, map, callback);
    }

    /**
     * 获取待返金额列表
     *
     * @param callback
     */
    public static void getRebate(HttpUtils.HttpCallback callback) {
        Map<String, String> map = new HashMap<>();
        map.put("access_token", Util.md5());
        map.put("page", "1");
        map.put("num", "100");
        map.put("uid", BaseApplication.uid);
        new HttpUtils().post(URL + REBATE, map, callback);
    }

    /**
     * 获取可用金额列表
     *
     * @param callback
     */
    public static void getCashBack(HttpUtils.HttpCallback callback) {
        Map<String, String> map = new HashMap<>();
        map.put("access_token", Util.md5());
        map.put("page", "1");
        map.put("num", "100");
        map.put("uid", BaseApplication.uid);
        new HttpUtils().post(URL + CASHBACK, map, callback);
    }

    /**
     * 获取积分账户数据
     *
     * @param callback
     */
    public static void getIntegral(HttpUtils.HttpCallback callback) {
        Map<String, String> map = new HashMap<>();
        map.put("access_token", Util.md5());
        map.put("uid", BaseApplication.uid);
        new HttpUtils().post(URL + INTEGRAL, map, callback);
    }

    /**
     * 获取余额充值页面
     *
     * @param callback
     */
    public static void getRecharge(HttpUtils.HttpCallback callback) {
        Map<String, String> map = new HashMap<>();
        map.put("access_token", Util.md5());
        map.put("uid", BaseApplication.uid);
        new HttpUtils().post(URL + RECHARGE, map, callback);
    }

    /**
     * @param callback
     */
    public static void setAddress(String addrid, HttpUtils.HttpCallback callback) {
        Map<String, String> map = new HashMap<>();
        map.put("access_token", Util.md5());
        map.put("uid", BaseApplication.uid);
        map.put("addrid", addrid);
        new HttpUtils().post(URL + SETADDRESS, map, callback);
    }

    /**
     * @param callback
     */
    public static void myRate(String page, String num, HttpUtils.HttpCallback callback) {
        Map<String, String> map = new HashMap<>();
        map.put("access_token", Util.md5());
        map.put("uid", BaseApplication.uid);
        map.put("page", page);
        map.put("num", num);
        new HttpUtils().post(URL + MYRATE, map, callback);
    }

    /**
     * @param callback
     */
    public static void submitRate(String img, String goods_id, String oid, String star, String content, HttpUtils.HttpCallback callback) {
        Map<String, String> map = new HashMap<>();
        map.put("access_token", Util.md5());
        map.put("uid", BaseApplication.uid);
        map.put("goods_id", goods_id);
        map.put("oid", oid);
        map.put("star", star);
        map.put("content", content);
        map.put("img", img);
        new HttpUtils().post(URL + SUBRATE, map, callback);
    }

    /**
     * @param callback
     */
    public static void delRate(String id, HttpUtils.HttpCallback callback) {
        Map<String, String> map = new HashMap<>();
        map.put("access_token", Util.md5());
        map.put("uid", BaseApplication.uid);
        map.put("id", id);
        new HttpUtils().post(URL + DELRATE, map, callback);
    }

    /**
     * @param callback
     */
    public static void cancleOrder(String oid, HttpUtils.HttpCallback callback) {
        Map<String, String> map = new HashMap<>();
        map.put("access_token", Util.md5());
        map.put("uid", BaseApplication.uid);
        map.put("oid", oid);
        new HttpUtils().post(URL + CANCELORDER, map, callback);
    }


    /**
     * @param callback
     */
    public static void reminderOrder(String oid, HttpUtils.HttpCallback callback) {
        Map<String, String> map = new HashMap<>();
        map.put("access_token", Util.md5());
        map.put("uid", BaseApplication.uid);
        map.put("oid", oid);
        new HttpUtils().post(URL + REMINDERORDER, map, callback);
    }

    /**
     * 发起余额充值
     *
     * @param type     支付类型：1=微信支付 2=支付宝支付
     * @param amount   支付金额
     * @param callback
     */
    public static void startRecharge(String type, String amount, HttpUtils.HttpCallback callback) {
        Map<String, String> map = new HashMap<>();
        map.put("access_token", Util.md5());
        map.put("uid", BaseApplication.uid);
        map.put("type", type);
        map.put("amount", amount);
        new HttpUtils().post(URL + STARTRECHARGE, map, callback);
    }

    /**
     * 修改支付密码
     *
     * @param mobile
     * @param code
     * @param newpassword
     * @param callback
     */
    public static void updatesPayPwd(String mobile, String code, String newpassword, String oldpassword, HttpUtils.HttpCallback callback) {
        Map<String, String> map = new HashMap<>();
        map.put("access_token", Util.md5());
        map.put("uid", BaseApplication.uid);
        map.put("mobile", mobile);
        map.put("code", code);
        map.put("newpassword", newpassword);
        map.put("oldpassword", oldpassword);
        new HttpUtils().post(URL + UPDATEPAYPWDS, map, callback);
    }

    /**
     * 设置支付密码
     *
     * @param mobile
     * @param code
     * @param paypassword
     * @param callback
     */
    public static void setPayPwd(String mobile, String code, String paypassword, HttpUtils.HttpCallback callback) {
        Map<String, String> map = new HashMap<>();
        map.put("access_token", Util.md5());
        map.put("uid", BaseApplication.uid);
        map.put("mobile", mobile);
        map.put("code", code);
        map.put("paypassword", paypassword);
        new HttpUtils().post(URL + SETPAYPWD, map, callback);
    }

    public static void get(String url, HttpUtils.HttpCallback callback) {
        new HttpUtils().get(url, callback);
    }

    /**
     * 获取免密支付的列表
     *
     * @param
     * @param callback
     */
    public static void getNoPwdPayList(HttpUtils.HttpCallback callback) {
        Map<String, String> map = new HashMap<>();
        map.put("access_token", Util.md5());
        new HttpUtils().post(URL + NoPwdPayList, map, callback);
    }

    /**
     * 开启免密支付
     *
     * @param amountID
     * @param callback
     */

    public static void setOpenNoPwdPay(String amountID, HttpUtils.HttpCallback callback) {
        Map<String, String> map = new HashMap<>();
        map.put("access_token", Util.md5());
        map.put("uid", BaseApplication.uid);
        map.put("amountID", amountID);
        new HttpUtils().post(URL + OpenNoPwdPay, map, callback);
    }

    /**
     * 设置订单已付款
     *
     * @param order_id
     * @param callback
     */
    public static void setPay(String order_id, HttpUtils.HttpCallback callback) {
        Map<String, String> map = new HashMap<>();
        map.put("access_token", Util.md5());
        map.put("uid", BaseApplication.uid);
        map.put("order_id", order_id);
        new HttpUtils().post(URL + SETPAY, map, callback);
    }

    /**
     * 是否绑定微信
     *
     * @param
     * @param callback
     */
    public static void IsBand(HttpUtils.HttpCallback callback) {
        Map<String, String> map = new HashMap<>();
        map.put("access_token", Util.md5());
        map.put("uid", BaseApplication.uid);
        new HttpUtils().post(URL + ISBAND, map, callback);
    }

    /**
     * 绑定微信
     *
     * @param openid
     * @param nickname
     * @param head
     * @param callback
     */
    public static void BandWx(String openid, String nickname, String head, HttpUtils.HttpCallback callback) {
        Map<String, String> map = new HashMap<>();
        map.put("access_token", Util.md5());
        map.put("uid", BaseApplication.uid);
        map.put("openid", openid);
        map.put("nickname", nickname);
        map.put("head", head);
        map.put("uid", BaseApplication.uid);
        new HttpUtils().post(URL + BANDWX, map, callback);
    }

    /**
     * 确认收货
     *
     * @param oid
     * @param callback
     */
    public static void receiving(String oid, HttpUtils.HttpCallback callback) {
        Map<String, String> map = new HashMap<>();
        map.put("access_token", Util.md5());
        map.put("oid", oid);
        new HttpUtils().post(URL + RECEIVING, map, callback);
    }

    /**
     * 判断手机号是否绑定
     * @param mobile
     * @param callback
     */
    public static void BundLingTeL(String mobile, HttpUtils.HttpCallback callback) {
        Map<String, String> map = new HashMap<>();
        map.put("mobile", mobile);
        map.put("access_token", Util.md5());
        new HttpUtils().post(URL + BundLingTeL, map, callback);
    }
}
